﻿using System.Collections.Generic;
using System.Data;
using Smatime.Web.DAO.SmatimeDatasetTableAdapters;
using Smatime.Web.Models;

namespace Smatime.Web.DAO
{
    public class StaffForgotCheckListRepository :
        BaseRepository
            <StaffGotgetCheckList, SmatimeDataset.StaffForgotCheckListDataTable, StaffForgotCheckListTableAdapter>
    {
        /// <summary>
        ///     Get list Staff Forgot check
        /// </summary>
        /// <returns></returns>
        public IEnumerable<StaffGotgetCheckList> GetListById(long id)
        {
            using (var adapter = new StaffForgotCheckListTableAdapter())
            {
                using (var table = adapter.GetDataBy(id))
                {
                    var list = new List<StaffGotgetCheckList>();
                    foreach (DataRow row in table.Rows)
                    {
                        var staffForgotCheck = new StaffGotgetCheckList();
                        staffForgotCheck.FromDataRow(row);
                        list.Add(staffForgotCheck);
                    }
                    return list;
                }
            }
        }
    }
}